﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace WebBuddy.UriBuddy
{
    /// <summary>
    /// Contains constants for controlling the kind of encoding to perform when creating
    /// a query string
    /// </summary>
    [Flags]
    public enum UrlEncoderOptions
    {

        /// <summary>
        /// Do not perform any encoding on the Url values
        /// </summary>
        None = 1,
        /// <summary>
        /// Encode the keys in the query string
        /// </summary>
        EncodeKeys = 2,
        /// <summary>
        /// Encode the values in the query string
        /// </summary>
        EncodeValues = 4

    }

    /// <summary>
    /// Extension to test for boolean values
    /// </summary>
    public static class UrlEncoderOptionsExtensions
    {
        /// <summary>
        /// Is a flag set on an <paramref name="UrlEncoderOptions"/>?
        /// </summary>
        /// <param name="options">The options</param>
        /// <param name="testFlag">the flag</param>
        /// <returns>True if it is</returns>
        public static bool IsSet(this UrlEncoderOptions options, UrlEncoderOptions testFlag)
        {
            return ( options & testFlag ) == testFlag;
        }
    } 
}
